package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.domain.PmsProductAttributeCategory;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 产品属性分类表 Mapper 接口
 * </p>
 *
 * @author zaxingli
 * @since 2022-11-09
 */
public interface PmsProductAttributeCategoryMapper extends BaseMapper<PmsProductAttributeCategory> {

    @Update("update pms_product_attribute_category set name = #{name} where id = #{id}")
    void updateName(Long id, String name);

    @Update("update pms_product_attribute_category set attribute_count = attribute_count + 1 where id = #{id}")
    void addAttribute(Long id);

    @Update("update pms_product_attribute_category set param_count = param_count + 1 where id = #{id}")
    void addParam(Long id);

    @Update("update pms_product_attribute_category set attribute_count = attribute_count - #{length} where id = #{id}")
    void subAttribute(Long id, int length);

    @Update("update pms_product_attribute_category set param_count = param_count - #{length} where id = #{id}")
    void subParam(Long id, int length);
}
